﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Newtonsoft.Json;

public partial class Rep_Cydymxnn : System.Web.UI.Page
{
    BLL.BLLRep br = new BLL.BLLRep();
    public static string pName = "";

    protected void Page_Load(object sender, EventArgs e)
    {
        string name = HttpUtility.UrlDecode(Request.QueryString["name"]);
        if (name != null & name != "")
        {
            pName = name;
        }

        string param = Request["param"];
        if (param != "")
        {
            if (param == "query")
            {
                string time = Convert.ToDateTime(Request["time"]).ToString("yyyy-MM");
                int unit = Convert.ToInt32(Request["unit"]);

                QueryTableList(pName, unit, time);
            }
        }
        else
        {
            QueryTableList(pName, 1, DateTime.Now.ToString("yyyy-MM"));
        }
    }
    protected void QueryTableList(string pName, int unit, string time)
    {
        string strApp = br.RetTableByMonthInfo(pName, unit, Convert.ToDateTime(time));

        object obj = new { tableInfo = strApp };
        string result = JavaScriptConvert.SerializeObject(obj);
        Response.Write(result);
        Response.End();
    }
}